package kz.edu.sdu.atm.ui.client;

import kz.edu.sdu.atm.client.Client;
import kz.edu.sdu.atm.client.ui.IDisplay;

import com.trolltech.qt.gui.QLayout;
import com.trolltech.qt.gui.QMessageBox;
import com.trolltech.qt.gui.QWidget;

public abstract class QMyWidget extends QWidget implements IDisplay {

	QMessageBox box;
	public QLayout layout;
	Client client;
	private String oldTitle;

	public QMyWidget(QWidget parent, Client client) {
		super(parent);
		this.client = client;
		box = new QMessageBox();
		// client.setDisplay(this);
		init();
		connectAll();
	}

	public synchronized void showMessage(String s) {
		box.setText(s);
		box.show();
	}

	abstract void init();

	abstract void connectAll();

	@Override
	public void showLoading(boolean ok) {
		if (ok)
			showMessage("Loading...");
		else
			box.hide();
	}
}
